
/**	A directional light source.
*/
struct DirectionalLight
{
	vec3	direction;
	vec3	color;
};
uniform DirectionalLight light;
uniform vec3 ambient_light;

varying vec3 position, normal;

void main()
{
	/* Calculate the directional light shading in world coordinates */
	vec3 N = normalize(normal);
	vec3 L = normalize(light.direction);
	float lambertTerm = max(0.0, dot(N, L));
	
	vec3 ambient = gl_Color.rgb * ambient_light;
	vec3 diffuse = gl_Color.rgb * lambertTerm * light.color;
	
	vec3 color = ambient + diffuse;
	gl_FragColor = vec4(color, 1.0);
}